<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>

<script type="text/javascript" src="<s:url value="/js/safety.js"/>"></script>

<sd:head parseContent="true"/>
    <div id="filter">
        <s:form id="formEdit" cssClass="tableFilter">

        <s:select label="Drug" name="droga.id" id="droga"
                  headerKey="-1" headerValue="Choose Drug"
                  list="drogaList"
                  listKey="id"
                  listValue="drugName"
                >
        </s:select>

        <s:select label="Protocol" name="protocolo.id" id="protocol"
                  headerKey="-1" headerValue="Choose Protocol"
                  list="protocoloList"
                  listKey="id"
                  listValue="id"
                >
        </s:select>

        <s:select label="Country" name="pais.id" id="country"
                  headerKey="-1" headerValue="Choose Country"
                  list="paisList"
                  listKey="id"
                  listValue="country"
                >
        </s:select>

        <s:select label="Document type" name="docType" id="docType"
                  headerKey="" headerValue="Choose Type"
                  list="tiposDocumentos"
                  listKey="type"
                  listValue="type"
                >
        </s:select>

        <s:textfield label="Date" name="fecha"  cssClass="datepicker"/>

        <s:textfield label="E-Mail" name="email" id="email" />

        <s:textfield label="Mailing ID" name="mailId" id="mailId" />

        <tr>
            <td  colspan="2" class="centeredButtons" >
                <s:submit value="Search" id="search" action="search" theme="simple" onclick="validateTracking()"/>
            </td>
        </tr>

        </s:form>
   </div>

<s:if test="!list.isEmpty()"  >
   <div id="table_content" style="margin-top: 0%">
    <table class="paginated-table">
            <thead>
            <tr>
                <th>Mailing ID</th>
                <th>Drug</th>
                <th>Documents</th>
                <th>Date</th>
                <th>View</th>
            </tr>
            </thead>
            <tbody>
            <s:iterator value="list" var="safety">
            <tr>
                <th><s:property value="%{#safety.id}"/></th>
                <th><s:property value="%{#safety.droga.drugName}"/></th>
                <th><s:property value="asuntoMail"/></th>
                <th><s:date name="#safety.fecha" format="dd-MMM-yy HH:mm" /></th>
                <s:url var="url" action="verSafety"  namespace="/"/>
                <th>
                    <img src="<s:url value="/images/eye.png"/>" onclick="verSafety('<s:property value="%{#url}"/>',<s:property value="%{#safety.id}"/>)"/>
                </th>
            </tr>
            </s:iterator>
            <tbody>
        </table>

        <div style="width: 100%;text-align: center" >
            <span class="prev" style="" >Previous</span><span class="next">Next</span>
        </div>

        <script type="text/javascript">
            paginar(15);
        </script>
    </div>

<script type="text/javascript">
    $('#tracking').css({"color":"#EE5102","fontWeight":"bold"});
</script>
</s:if>